<?php
/**
 * 周舟 hzboye010@163.com
 * addby sublime snippets
 * tag domain !-_-!
 */
namespace app\index\domain;

use app\index\domain\BaseDomain;
use app\bbs\api\TagApi;

class TagDomain extends BaseDomain{
  protected $business_code = 'baby';
  /**
   * 批量添加
   */
  public function addAll(){
		$this->checkVersion($this->api_ver);
		addLog("Tag/addAll",$_GET,$_POST,"应用" . $this->client_id . "调用Baby添加接口");

		$uid     		= $this->_post("uid",0,"UID不能为空");
		$tid     		= $this->_post("tid",0);
		$tag_name 	= $this->_post("tag_name",'','标签名不许为空');
		$result     = apiCall(TagApi::ADD_S,[$tag_name,false,$tid]);
		if(!$result['status']) $this->apiReturnErr($result['info']);
		$this->apiReturnSuc('添加成功');
	}

	public function finds(){
		$this->checkVersion($this->api_ver);
		addLog("Tag/finds",$_GET,$_POST,"应用" . $this->client_id . "调用Baby添加接口");

		$uid    = $this->_post("uid",0);
		$sort   = $this->_post("sort",0);
		$number = $this->_post("number",10);
		$result = apiCall(TagApi::FIND_S,[$sort,$number,'id,name,used']);
		if(!$result['status']) $this->apiReturnErr($result['info']);
		$this->apiReturnSuc($result['info']);
	}
}